<template>
  <div class="couponsdetails">
    <div style="margin:0 0 20px 0">会员卡号：{{customernumber.customerCard}}</div>
    <!-- <el-row style="margin:0 0 30px 0">
    <el-button size="mini" @click="allCoupon">全部</el-button>
      <el-button size="mini" @click="used">已使用</el-button>
      <el-button size="mini" @click="expired">已过期</el-button>
      <el-button size="mini" @click="deleted">已删除</el-button>
    </el-row> -->
    <el-button style="margin:0 0 10px 95%" type="primary" size="mini" @click="returntop">返回</el-button>
      <el-table
        border
        :data="mbershipData"
        size="mini"
        :header-cell-style="{
          color: '#fff',
          background: '#6090EC',
          fontSize: '11px',
          fontWeight: 'normal',
        }">
        <el-table-column prop="name" label="优惠券类型名称" width="120"></el-table-column>
        <el-table-column prop="invalidTime" label="过期时间" width="100"></el-table-column>
        <el-table-column prop="content" label="使用规则" width="100"></el-table-column>
        <el-table-column prop="scope" label="适用范围" ></el-table-column>
        <!-- <el-table-column prop="couponType" label="优惠卷类型" width="100"></el-table-column> -->
        <el-table-column prop="couponDiscount" label="抵扣卷折扣" width="100"></el-table-column>
        <el-table-column prop="couponMaxprice" label="优惠卷最大金额" width="120"></el-table-column>
        <el-table-column prop="couponPrice" label="优惠卷优惠金额" width="120"></el-table-column>
      </el-table>
  </div>
</template>

<script>
export default {
  name: 'couponsdetails',
  data() { 
    return {
      customernumber:{},
      mbershipData:[],
      customerId:"",
      currentPage:'',
      pageSize:''
    }
  },
  methods:{
    // 返回
    returntop(){
      this.$router.go(-1)
    },
    // 会员卡号
    getinformation(){
      this.$axios.getinformation({
        id:this.customerId,
      }).then((res)=>{
        console.log(res)
        this.customernumber=res.data
        if(res.code==200){
          this.getcouponRecord()
        }
      })
    },
    // used(){
    //   localStorage.setItem("pageNum", this.currentPage);
    //   localStorage.setItem("pageSize", this.pageSize);
    //   this.$axios.getcouponRecord({
    //     id:this.customernumber.customerId,
    //     type:"unexecuted"
    //   }).then((res)=>{
    //     console.log(res)
    //     this.mbershipData=res.data
    //   })
    // },
    //  expired(){
    //   localStorage.setItem("pageNum", this.currentPage);
    //   localStorage.setItem("pageSize", this.pageSize);
    //   this.$axios.getcouponRecord({
    //      id:this.customernumber.customerId,
    //     type:"expired"
    //   }).then((res)=>{
    //     console.log(res)
    //     this.mbershipData=res.data
    //   })
    // },
    //  deleted(){
    //   localStorage.setItem("pageNum", this.currentPage);
    //   localStorage.setItem("pageSize", this.pageSize);
    //   this.$axios.getcouponRecord({
    //     id:this.customernumber.customerId,
    //     type:"deleted"
    //   }).then((res)=>{
    //     console.log(res)
    //     this.mbershipData=res.data
    //   })
    // },
    getcouponRecord(){
      localStorage.setItem("pageNum", this.currentPage);
      localStorage.setItem("pageSize", this.pageSize);
       this.$axios.getcouponRecord({
         id:this.customernumber.customerId,
        type:"unexecuted"
      }).then((res)=>{
        console.log(res)
        this.mbershipData=res.data
      })
    },
    // allCoupon()
    // {
    //   localStorage.setItem("pageNum", this.currentPage);
    //   localStorage.setItem("pageSize", this.pageSize);
    //    this.$axios.getcouponRecord({
    //      id:this.customernumber.customerId,
    //     type:"all"
    //   }).then((res)=>{
    //     console.log(res)
    //     this.mbershipData=res.data
    //   })
    // }
  },
  mounted() {
     this.customerId = this.$route.params.customerId;
     this.getinformation()
     
  },
 }
</script>

<style  scoped>
.couponsdetails{
  margin: 20px;
}
</style>